package cn.com.klun.tjy.api.controller;

import cn.com.klun.tjy.common.basePojo.AbstractApiController;
import com.alibaba.fastjson.JSONObject;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

/**
 * <Description> 异常结果控制器 </Description>
 * <ClassName> ResultController </ClassName>
 *
 * @Author generator
 * @Date 2018年01月09日 13时:38分:52秒
 */
@Controller
@RequestMapping("/result")
public class ResultController extends AbstractApiController {

    @RequestMapping("/404error")
    public void error404(Model model, HttpServletRequest request, HttpServletResponse response) {
        JSONObject jsonObject = new JSONObject();
        jsonObject.put("code", ERROR);
        jsonObject.put("msg", "404");
        ajaxJsonMessage(response, jsonObject.toString());
    }

    @RequestMapping("/500error")
    public void error500(Model model, HttpServletRequest request, HttpServletResponse response) {
        JSONObject jsonObject = new JSONObject();
        jsonObject.put("code", ERROR);
        jsonObject.put("msg", "500");
        ajaxJsonMessage(response, jsonObject.toString());
    }

}